﻿<UserControl x:Class="Sautom.Modules.Client.Controls.OrderEditor"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:res="clr-namespace:Sautom.I18N;assembly=Sautom.I18N" 
             xmlns:l="clr-namespace:Sautom.ClientComunication.Converters;assembly=Sautom.ClientComunication" mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <l:IsGroupTypeToTextConverter x:Key="IsGroupTypeToTextConverter" />
        <l:InverseBooleanConverter x:Key="InverseBooleanConverter" />

        <Style TargetType="{x:Type ListBox}" x:Key="RecruiterList">
            <Setter Property="ItemTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <Border BorderBrush="Black" BorderThickness="2" CornerRadius="2" Padding="5">
                            <TextBlock Text="{Binding DisplayName}" />
                        </Border>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style TargetType="{x:Type ComboBox}">
            <Setter Property="ItemTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <TextBlock Text="{Binding Value}" />
                    </DataTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    <StackPanel>
        <Label Content="{Binding Source={x:Static res:ClientResources.ProposalLabel}}" />
        <StackPanel>
            <ListBox MaxHeight="150" ItemsSource="{Binding Proposals}" SelectedItem="{Binding SelectedProposal, Mode=TwoWay}">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="60*" />
                                <ColumnDefinition Width="60*" />
                                <ColumnDefinition Width="60*" />
                            </Grid.ColumnDefinitions>
                            <StackPanel  Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Top">
                                <TextBlock Text="{Binding County}" />
                                <TextBlock Text="{Binding City}" />
                            </StackPanel>
                            <StackPanel Grid.Column="1" HorizontalAlignment="Left">
                                <TextBlock Text="{Binding SchoolName}" />
                                <TextBlock Text="{Binding CourseName}" />
                            </StackPanel>
                            <StackPanel Grid.Column="2" HorizontalAlignment="Right">
                                <TextBlock Text="{Binding IsGroupType, Converter={StaticResource IsGroupTypeToTextConverter}}" />
                                <TextBlock Text="{Binding StartDate, StringFormat=d}" />
                            </StackPanel>
                        </Grid>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
            <StackPanel>
                <Label Content="{Binding Source={x:Static res:ClientResources.StartDateLabel}}" />
                <DatePicker SelectedDate="{Binding StartDate, StringFormat=d}" DisplayDateEnd="{Binding EndDate}" IsEnabled="{Binding IsGroupType, Converter={StaticResource InverseBooleanConverter}}" />
                <Label Content="{Binding Source={x:Static res:ClientResources.EndDateLabel}}" />
                <DatePicker SelectedDate="{Binding EndDate, StringFormat=d}" DisplayDateStart="{Binding StartDate}" IsEnabled="{Binding IsGroupType, Converter={StaticResource InverseBooleanConverter}}" />

                <Label Content="{Binding Source={x:Static res:ClientResources.IntensityLabel}}" />
                <ComboBox SelectedItem="{Binding Intensity}" ItemsSource="{Binding IntensityTypes}" IsEnabled="{Binding IsGroupType, Converter={StaticResource InverseBooleanConverter}}" />

                <Label Content="{Binding Source={x:Static res:ClientResources.HouseTypeLabel}}" />
                <ComboBox SelectedItem="{Binding HouseType}" ItemsSource="{Binding HouseTypeList}" IsEnabled="{Binding IsGroupType, Converter={StaticResource InverseBooleanConverter}}" />
            </StackPanel>
        </StackPanel>
        <Label Content="{Binding Source={x:Static res:ClientResources.ResponsibleManagerLabel}}" />
        <ListBox MaxHeight="100" ItemsSource="{Binding Managers}" SelectedItem="{Binding SelectedManager}" Style="{StaticResource RecruiterList}" />
    </StackPanel>
</UserControl>
